<?php $this->load->view('common/header'); ?>
<?php echo admin_js_url('codeigniter-csrf'); ?>
<?php $this->load->view('common/menu'); ?>

    <div class="banner_box"><img src="<?php echo image_url('banner_01.jpg'); ?>"></div>

    <div class="main_box">
        <div class="title p_t">
            <a href="/join/4.html">生产伙伴</a>
            <a href="/join_label.html" class="on">洽谈联系</a>
        </div>
        <div class="input_box">
            <div class="l_img f_l">
                <img src="<?php echo image_url('join_img.jpg'); ?>">
            </div>
            <div class="l_box f_r">
                <div class="l_con">广东华晟包装科技股份公司，感谢您的信任！</div>
                <div class="iput">
                    <span class="inp w2 f_l"><input placeholder="称呼" id="sub_name"></span>
                    <span class="inp w2 f_r"><input placeholder="手机号码" id="sub_tel"></span>
                </div>
                <!--                <div class="iput">-->
                <!--                    <span class="inp w2 f_l"><input placeholder="Email" id="sub_email"></span>-->
                <!--                    <span class="inp w2 f_r"><input placeholder="地址" id="sub_address"></span>-->
                <!--                </div>-->
                <div class="iput">
                <span class="tex">
                    <textarea placeholder="简要说明来意" id="sub_con"></textarea>
                </span>
                </div>
                <div class="iput">
                    <span class="nav w2"><input value="确定提交" id="submit33" type="button"></span>
                </div>
            </div>
        </div>
    </div>
<?php echo admin_js_url('layer/layer'); ?>
    <script>
        $(document).on("click", "#submit33", function () {
            var name = $("#sub_name").val();
            // var email = $("#sub_email").val();
            var tel = $("#sub_tel").val();
            // var address = $("#sub_address").val();
            var con = $("#sub_con").val();

            var reg = /\w+[@]{1}\w+[.]\w+/;
            // if (email == '' || email == undefined) {
            //     layer.alert("请输入email地址");
            //     return false;
            // }
            // if (!reg.test(email)) {
            //     layer.alert("请输入正确的email地址");
            //     return false;
            // }
            var url = "/message";
            $.ajax({
                url: url,
                type: "post",
                data: {'name': name, 'mobile': tel, 'con': con,'csrf_test_name': ci_csrf_token()},
                dataType: 'json',
                success: function (data) {
                    console.log(data);
                    if (data.status == 1) {
                        layer.alert("留言成功", {
                            skin: 'layui-layer-lan'
                            , closeBtn: 1
                            , anim: 5 //动画类型
                        }, function (index) {
                            window.location.href = window.location.href;
                        });

                    } else {
                        layer.alert(data.msg);
                    }
                }
            });
        });
    </script>
<?php $this->load->view('common/footer'); ?>